# 08-猜数游戏.py
import random
num = random.randint(1,10000) # 电脑出题
a =0 # 玩家猜的数字
count=0 # 猜的次数
while a!=num:
    count+=1
    a = int(input('请输入猜的数字：'))
    if count>20:
        num = random.randint(1,10000)
    elif a>num:
        print('猜大了')
    elif a<num:
        print('猜小了')
    else:
        print(f'猜对了：{a},猜了{count}次')